<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        tr{
            height:50px;
            font-size: 23px;
        }
        #one{
            width: 200px;
            float: left;
        }
        #two{
            clear: left;
            margin-left:20px;
        }
        .one{
            border: none;
            border-radius: 5px;
        }
        .two{
            border: none;
            border-radius: 5px;
        }
    </style>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.0/dist/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="container"><br>
    <form>
        <div class="form-group">
            <input type="text" id="one" class="form-control" name="user_name" placeholder="请输入搜索的用户名">
            <button type="submit" class="btn btn-primary" id="two">搜索</button>
        </div>
    </form>
    <button onclick="fun_1()" class="one">全选</button>
    <button onclick="fun_2()" class="one">全不选</button>
    <button onclick="fun_3()" class="one">反选</button>
    <br> <br>
    <table class="table">
        <thead class="thead-dark">
        <tr>
            <th scope="col"> </th>
            <th scope="col">用户名</th>
            <th scope="col">性别</th>
            <th scope="col">邮箱</th>
            <th scope="col">预存款</th>
            <th scope="col">积分</th>
            <th scope="col">状态</th>
            <th scope="col">注册日期</th>
            <th scope="col">操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $data as $value}
        <tr>
            <th scope="row">
                <input type="checkbox" name="check" value="{$value.id}">
            </th>
            <td>{$value.user_name}</td>
            <td>{$value.user_sex}</td>
            <td>{$value.email}</td>
            <td>0.00</td>
            <td>0</td>
            <td>正常</td>
            <td>{$value.created_at}</td>
            <td>
                <button class="two">删除</button> |
                <button class="two">编辑</button>
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {$data|raw}
</div>
</body>
</html>
<script>
    function fun_1(){
        var check = document.getElementsByName('check');
        for(var i=0;i<check.length;i++){
            check[i].checked = true;
        }
    }
    function fun_2(){
        var check = document.getElementsByName('check');
        for(var i=0;i<check.length;i++){
            check[i].checked = false;
        }
    }
    function fun_3(){
        var check = document.getElementsByName('check');
        for(var i=0;i<check.length;i++){
            check[i].checked =! check[i].checked;
        }
    }
</script>